/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package servicios;

import dao.Categoria;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Suco
 */
public class categoriaServicios {
    
    Categoria cat;

    public categoriaServicios(Categoria cat) {
        this.cat = cat;
    }
    
    public ArrayList<Categoria> getListaCategoria () {

       ArrayList<Categoria> ac=new ArrayList<Categoria>();
       Categoria categoria;
            ResultSet rs=cat.consultaTodos();
        
            try {
            while(rs.next()){
                categoria=new Categoria(rs.getString(1), rs.getString(2), rs.getString(3),rs.getString(4));
                ac.add(categoria);
            }
            } catch (SQLException ex) {
            Logger.getLogger(categoriaServicios.class.getName()).log(Level.SEVERE, null, ex);
        }
           return ac;
    } 
}
